package com.societyGames.codeAlong.state.codeExercise.model.help
{
import com.societyGames.system.IXmlInitialize;

import flash.utils.getDefinitionByName;

public class SyntaxErrorHelpFactory
{
  private static var beginsWithSyntaxHelp:BeginsWithSyntaxHelp; //Keeps it from compiling out.

  public static function create(xml:XML):ISyntaxErrorHelp
  {
    var className:String = "com.societyGames.codeAlong.state.codeExercise.model.help." + xml.@type;
    var helpClass:Class = Class(getDefinitionByName(className));
    var syntaxErrorHelp:ISyntaxErrorHelp = ISyntaxErrorHelp(new helpClass());
    IXmlInitialize(syntaxErrorHelp).initializeWithXml(xml);
    return syntaxErrorHelp;
  }
}
}